package com.zhouyibike.uu.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.zhouyibike.uu.R;
import com.zhouyibike.uu.entity.YCQResult;

import java.util.List;

/**
 * Created by cc on 2017/5/3.
 */

public class YCQAdapter extends BaseAdapter {
    private Context context;
    private List<YCQResult.DataBean> list;

    public YCQAdapter(Context context, List<YCQResult.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView= LayoutInflater.from(context).inflate(R.layout.item_ycq,null);
        TextView tv_money= (TextView) convertView.findViewById(R.id.tv_item_ycmoney);
        TextView tv_endtime= (TextView) convertView.findViewById(R.id.tv_item_endtime);
        tv_money.setText(list.get(position).getAmount()+"");
        tv_endtime.setText(list.get(position).getValidEndDay()+"前有效");
        return convertView;
    }
}
